package com.penghaisoft.microwms.product.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.penghaisoft.microwms.common.dto.Resp;
import com.penghaisoft.microwms.common.page.Pager;
import com.penghaisoft.microwms.common.service.BaseService;
import com.penghaisoft.microwms.common.wms.model.ProOrderInSn;
import com.penghaisoft.microwms.product.dao.ProOrderInSnMapper;
import com.penghaisoft.microwms.product.service.IProOrderInSnService;
import com.penghaisoft.microwms.product.service.IProScannerInSnService;

/** 
* @ClassName: ProOrderInSnServiceImpl 
* @Description: 成品扫描入库明细表 service
* @author yanggm
* @date 2018年8月16日 下午4:17:52  
*/
@Service("ProOrderInSnService")
public class ProScannerInSnServiceImpl extends BaseService implements 
		IProScannerInSnService {
	@Resource
	private ProOrderInSnMapper ProOrderInSnMapper;
	
	/**
	 * 查询列表
	 * 
	 * @param pager
	 * @param baseResource
	 * @return
	 */
	@Override
	public Pager<ProOrderInSn> findListByCondition(int page, int rows, ProOrderInSn condtion) {
		Pager<ProOrderInSn> pager = new Pager<ProOrderInSn>();
		pager.setPage(page);
		pager.setRows(rows);
		condtion.preQuery();
		long size = ProOrderInSnMapper.queryCount(condtion);
		List<ProOrderInSn> records = new ArrayList<>();
		if(size > 0){
			records = ProOrderInSnMapper.queryList(pager, condtion);
		}
		pager.setRecords(records);
		pager.setTotalCount(size);
		return pager;
	}

	/**
	 * 新增记录
	 * 
	 * @param baseResource
	 * @return
	 */
	@Override
	public Resp create(ProOrderInSn ProOrderInSn) {
		ProOrderInSnMapper.delete(ProOrderInSn);
		return success();
	}

	/**
	 * 删除记录
	 * 
	 * @param baseResource
	 * @return
	 */
	@Override
	public Resp delete(ProOrderInSn ProOrderInSn) {
		ProOrderInSnMapper.create(ProOrderInSn);
		return success();
	}

	/**
	 * 修改记录
	 * 
	 * @param baseResource
	 * @return
	 */
	@Override
	public Resp update(ProOrderInSn ProOrderInSn) {
		ProOrderInSnMapper.update(ProOrderInSn);
		return success();
	}

}
